package ck.com.api;

import ck.com.dto.Dto;
import ck.com.pojo.GoodsSpecification;
import ck.com.pojo.OrderDetail;
import ck.com.pojo.Specification;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

public interface GoodsApi {

    @RequestMapping("goodsList")
    Dto<List<GoodsSpecification>> getGoodsList(@RequestBody Map<String,Object> params);

    @RequestMapping("goodsListCount")
    Integer getGoodsListCount(@RequestBody Map<String,Object> params);

    @RequestMapping("setLockStatus")
    Dto<Integer> setLockStatus(@RequestParam(value = "lockStatus") Integer lockStatus,@RequestParam(value = "goodsId") Integer goodsId);

    @RequestMapping("delGoods")
    Dto<Integer> delGoods(@RequestParam(value = "goodsId")Integer goodsId);

    @RequestMapping("delGoodList")
    Dto<Integer> delByList(@RequestBody List<Integer> goodsList);

    @RequestMapping("getGoodsByName")
    Dto<List<GoodsSpecification>> getGoodsByName(@RequestParam(value = "goodsName") String goodsName);

    @RequestMapping("getGoodsById")
    Dto<List<GoodsSpecification>> getGoodsById(@RequestParam(value = "goodsId") Integer goodsId);

    @RequestMapping("singleSpecList")
    Dto<List<Specification>> single();

    @RequestMapping("multiSpecList")
    Dto<List<Specification>> multi();

    @RequestMapping("goods")
    Dto<Integer> addGoods(@RequestBody Map<String,Object> params);

    @RequestMapping("goodsInfo")
    Dto<Integer> addGoodsInfo(@RequestBody Map<String,Object> params);

    @RequestMapping("OneGoods")
    Dto<GoodsSpecification> getOneGoods(@RequestParam(value = "goodsId") Integer goodsId);


    @RequestMapping("update")
    Dto<Integer> updateGoods(@RequestBody Map<String,Object> params);


    @RequestMapping("getNewId")
    Dto<Integer> getNewId();

    @RequestMapping("updateStock")
    Dto<Integer> updateStock(@RequestParam(value = "stock") Integer stock,@RequestParam(value = "id") Integer id);

    @RequestMapping("/decreaseStock")
    Dto<Integer>  decreaseStock(@RequestBody List<OrderDetail> list);
    @RequestMapping("/decreaseQuantity")
    Dto<Integer> decreaseQuantity(@RequestBody Map<String,Object> map);
    @RequestMapping("/releaseLock")
    Dto<Integer> releaseLock(@RequestBody List<OrderDetail> list);

    @RequestMapping("/getGoodsListj")
    Dto<PageInfo<GoodsSpecification>> getGoodsListj(@RequestBody Map<String,Object> map);
}
